import React, { Component } from 'react';
import api from '../../api';
import SingerSheetHeader from './Header';
import Sheet from '../component/Sheet';

class SingerSheet extends Component {
        constructor(props) {
        super(props)
    
        this.state = {
            hotSongs:null,
            artist:null
        }
    }
    componentDidMount(){
        api.getPublic(`/artists?id=${this.props.location.state.id}`).then(res=>{
            // console.log(res.data);
            this.setState({
                hotSongs:res.data,
                artist:res.data.artist
            })
        })
    }
    render() {
        // console.log(this);
        return (
            <div>
                <SingerSheetHeader articst={this.state.artist}/>
                <Sheet msg={this.state.hotSongs}/>
            </div>
        );
    }
}

export default SingerSheet;